import CountUI from "../../components/Count";
//import store
//import store from "../../redux/store";

import {connect} from 'react-redux'
import { createIncrementAction,createDecrementAction,createIncrementAsyncAction } from '../../redux/count_action'


const mapStateToProps = (state)=>{
    
    return {'sum':state}
}
const mapDispatchToProps = (dispatch)=>{ 
    
    return {act:(sum,actCode)=>{
        //
        console.log('this is countUI log...',sum,actCode)
        switch (actCode) {
            case 'createIncrementAction':
                dispatch(createIncrementAction(sum))
                break;
            case 'createDecrementAction':
                dispatch(createDecrementAction(sum))
                break;
            case 'createIncrementAsyncAction':
                dispatch(createIncrementAsyncAction(sum))
                break;
            default:
                break;
        }
    }}
}

const CountUIcontainer = connect(mapStateToProps,mapDispatchToProps)(CountUI)

export default CountUIcontainer